package com.bingguo.sys.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bingguo.sys.entity.SysUser;
import com.bingguo.sys.mapper.SysUserMapper;
import com.bingguo.sys.service.SysUserService;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> implements SysUserService {
    @Resource
    private SysUserMapper sysUserMapper;

    @Override
    public List<SysUser> getSysUserList() {
        Page<SysUser> pageInfo = PageHelper.startPage(1, 1);
        List<SysUser> sysUserList = sysUserMapper.getSysUserList();
//        int total = (int) pageInfo.getTotal();
        long total = new PageInfo<>(sysUserList).getTotal();
        return sysUserList;
    }

    public List<SysUser> getSysUsers(){
        List<SysUser> list = this.lambdaQuery()
                .and(qw -> qw.eq(SysUser::getPassWord, "1"))
                .list();
        return list;
    }

}
